import pytest,requests,pymysql

@pytest.fixture(scope='session')
def gettoken():
    url = 'http://10.59.9.32/jeewms/rest/pdaapi/login'
    body = {"userName": "admin", "password": "llg123"}

    r = requests.post(url, json=body, timeout=10).json()
    print(r)
    token = r.get('result').get('userKey')
    # token1 = r['result']['userKey']
    yield token

@pytest.fixture(scope='function')
def setupteardown():
    print("每个用例执行前，准备资源")
    yield
    print("每个用例执行后，清理资源")

@pytest.fixture(scope='session')
def db():
    conn = pymysql.connect(host='120.53.143.236',user='root',password='123456Aa',database='wms')
    cur = conn.cursor()
    yield cur
    cur.close()
    conn.close()




















